package com.alennus.blog.service;

import com.alennus.blog.domain.AccountRole;
import com.alennus.blog.repository.AccountRoleRepository;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * Created by pactera on 2018/6/6.
 */
@Service
public class AccountRoleService {

    @Autowired
    private AccountRoleRepository accountRoleRepository;




    public AccountRole saveOrUpdate(AccountRole accountRole){
        return accountRoleRepository.save(accountRole);
    }

    public List<AccountRole> saveOrUpdate(List<AccountRole> accountRole){
        return accountRoleRepository.saveAll(accountRole);
    }
    public void delete(String accountId){
        accountRoleRepository.deleteByAccountId(accountId);
    }

    public List<AccountRole> findByAccountId(String accountId){
        return accountRoleRepository.findByAccountId(accountId);
    }

}
